<?xml version='1.0' encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <link href="cpip.css" rel="stylesheet" type="text/css" />
    <title>File: /usr/include/sys/wait.h</title>
  </head>
  <body>
    <h1>File: /usr/include/sys/wait.h</h1>
    <p>Green shading in the line number column
means the source is part of the translation unit, red means it is conditionally excluded.
Highlighted line numbers link to the translation unit page. Highlighted macros link to
the macro page.</p>
    <pre><a name="1" /><span class="True">       1:</span> <span class="k">/*</span>
<a name="2" /><span class="True">       2:</span> <span class="k"> * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.</span>
<a name="3" /><span class="True">       3:</span> <span class="k"> *</span>
<a name="4" /><span class="True">       4:</span> <span class="k"> * @APPLE_OSREFERENCE_LICENSE_HEADER_START@</span>
<a name="5" /><span class="True">       5:</span> <span class="k"> * </span>
<a name="6" /><span class="True">       6:</span> <span class="k"> * This file contains Original Code and/or Modifications of Original Code</span>
<a name="7" /><span class="True">       7:</span> <span class="k"> * as defined in and that are subject to the Apple Public Source License</span>
<a name="8" /><span class="True">       8:</span> <span class="k"> * Version 2.0 (the &apos;License&apos;). You may not use this file except in</span>
<a name="9" /><span class="True">       9:</span> <span class="k"> * compliance with the License. The rights granted to you under the License</span>
<a name="10" /><span class="True">      10:</span> <span class="k"> * may not be used to create, or enable the creation or redistribution of,</span>
<a name="11" /><span class="True">      11:</span> <span class="k"> * unlawful or unlicensed copies of an Apple operating system, or to</span>
<a name="12" /><span class="True">      12:</span> <span class="k"> * circumvent, violate, or enable the circumvention or violation of, any</span>
<a name="13" /><span class="True">      13:</span> <span class="k"> * terms of an Apple operating system software license agreement.</span>
<a name="14" /><span class="True">      14:</span> <span class="k"> * </span>
<a name="15" /><span class="True">      15:</span> <span class="k"> * Please obtain a copy of the License at</span>
<a name="16" /><span class="True">      16:</span> <span class="k"> * http://www.opensource.apple.com/apsl/ and read it before using this file.</span>
<a name="17" /><span class="True">      17:</span> <span class="k"> * </span>
<a name="18" /><span class="True">      18:</span> <span class="k"> * The Original Code and all software distributed under the License are</span>
<a name="19" /><span class="True">      19:</span> <span class="k"> * distributed on an &apos;AS IS&apos; basis, WITHOUT WARRANTY OF ANY KIND, EITHER</span>
<a name="20" /><span class="True">      20:</span> <span class="k"> * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,</span>
<a name="21" /><span class="True">      21:</span> <span class="k"> * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,</span>
<a name="22" /><span class="True">      22:</span> <span class="k"> * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.</span>
<a name="23" /><span class="True">      23:</span> <span class="k"> * Please see the License for the specific language governing rights and</span>
<a name="24" /><span class="True">      24:</span> <span class="k"> * limitations under the License.</span>
<a name="25" /><span class="True">      25:</span> <span class="k"> * </span>
<a name="26" /><span class="True">      26:</span> <span class="k"> * @APPLE_OSREFERENCE_LICENSE_HEADER_END@</span>
<a name="27" /><span class="True">      27:</span> <span class="k"> */</span>
<a name="28" /><span class="True">      28:</span> <span class="k">/* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */</span>
<a name="29" /><span class="True">      29:</span> <span class="k">/*</span>
<a name="30" /><span class="True">      30:</span> <span class="k"> * Copyright (c) 1982, 1986, 1989, 1993, 1994</span>
<a name="31" /><span class="True">      31:</span> <span class="k"> *    The Regents of the University of California.  All rights reserved.</span>
<a name="32" /><span class="True">      32:</span> <span class="k"> *</span>
<a name="33" /><span class="True">      33:</span> <span class="k"> * Redistribution and use in source and binary forms, with or without</span>
<a name="34" /><span class="True">      34:</span> <span class="k"> * modification, are permitted provided that the following conditions</span>
<a name="35" /><span class="True">      35:</span> <span class="k"> * are met:</span>
<a name="36" /><span class="True">      36:</span> <span class="k"> * 1. Redistributions of source code must retain the above copyright</span>
<a name="37" /><span class="True">      37:</span> <span class="k"> *    notice, this list of conditions and the following disclaimer.</span>
<a name="38" /><span class="True">      38:</span> <span class="k"> * 2. Redistributions in binary form must reproduce the above copyright</span>
<a name="39" /><span class="True">      39:</span> <span class="k"> *    notice, this list of conditions and the following disclaimer in the</span>
<a name="40" /><span class="True">      40:</span> <span class="k"> *    documentation and/or other materials provided with the distribution.</span>
<a name="41" /><span class="True">      41:</span> <span class="k"> * 3. All advertising materials mentioning features or use of this software</span>
<a name="42" /><span class="True">      42:</span> <span class="k"> *    must display the following acknowledgement:</span>
<a name="43" /><span class="True">      43:</span> <span class="k"> *    This product includes software developed by the University of</span>
<a name="44" /><span class="True">      44:</span> <span class="k"> *    California, Berkeley and its contributors.</span>
<a name="45" /><span class="True">      45:</span> <span class="k"> * 4. Neither the name of the University nor the names of its contributors</span>
<a name="46" /><span class="True">      46:</span> <span class="k"> *    may be used to endorse or promote products derived from this software</span>
<a name="47" /><span class="True">      47:</span> <span class="k"> *    without specific prior written permission.</span>
<a name="48" /><span class="True">      48:</span> <span class="k"> *</span>
<a name="49" /><span class="True">      49:</span> <span class="k"> * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS&apos;&apos; AND</span>
<a name="50" /><span class="True">      50:</span> <span class="k"> * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE</span>
<a name="51" /><span class="True">      51:</span> <span class="k"> * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE</span>
<a name="52" /><span class="True">      52:</span> <span class="k"> * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE</span>
<a name="53" /><span class="True">      53:</span> <span class="k"> * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL</span>
<a name="54" /><span class="True">      54:</span> <span class="k"> * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS</span>
<a name="55" /><span class="True">      55:</span> <span class="k"> * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)</span>
<a name="56" /><span class="True">      56:</span> <span class="k"> * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT</span>
<a name="57" /><span class="True">      57:</span> <span class="k"> * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY</span>
<a name="58" /><span class="True">      58:</span> <span class="k"> * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF</span>
<a name="59" /><span class="True">      59:</span> <span class="k"> * SUCH DAMAGE.</span>
<a name="60" /><span class="True">      60:</span> <span class="k"> *</span>
<a name="61" /><span class="True">      61:</span> <span class="k"> *    @(#)wait.h    8.2 (Berkeley) 7/10/94</span>
<a name="62" /><span class="True">      62:</span> <span class="k"> */</span>
<a name="63" /><span class="True">      63:</span>  
<a name="64" /><span class="True">      64:</span> <span class="f">#</span><span class="n">ifndef</span> <a href="macros_noref.html#_X1NZU19XQUlUX0hfXzA_"><span class="b">_SYS_WAIT_H_</span></a>
<a name="65" /><span class="True">      65:</span> <span class="f">#</span><span class="n">define</span>    <a href="macros_noref.html#_X1NZU19XQUlUX0hfXzA_"><span class="b">_SYS_WAIT_H_</span></a>
<a name="66" /><span class="True">      66:</span> 
<a name="67" /><span class="True">      67:</span> <span class="f">#</span><span class="n">include</span> <span class="f">&lt;</span><span class="b">sys</span><span class="f">/</span><span class="b">cdefs</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>
<a name="68" /><span class="True">      68:</span> <span class="f">#</span><span class="n">include</span> <span class="f">&lt;</span><span class="b">sys</span><span class="f">/</span><span class="b">_types</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>
<a name="69" /><span class="True">      69:</span> 
<a name="70" /><span class="True">      70:</span> <span class="k">/*</span>
<a name="71" /><span class="True">      71:</span> <span class="k"> * This file holds definitions relevent to the wait4 system call</span>
<a name="72" /><span class="True">      72:</span> <span class="k"> * and the alternate interfaces that use it (wait, wait3, waitpid).</span>
<a name="73" /><span class="True">      73:</span> <span class="k"> */</span>
<a name="74" /><span class="True">      74:</span> 
<a name="75" /><span class="True">      75:</span> <span class="k">/*</span>
<a name="76" /><span class="True">      76:</span> <span class="k"> * [XSI] The type idtype_t shall be defined as an enumeration type whose</span>
<a name="77" /><span class="True">      77:</span> <span class="k"> * possible values shall include at least P_ALL, P_PID, and P_PGID.</span>
<a name="78" /><span class="True">      78:</span> <span class="k"> */</span>
<a name="79" /><span class="True">      79:</span> <span class="m">typedef</span> <span class="m">enum</span> <span class="f">{</span>
<a name="80" /><span class="True">      80:</span>     <span class="b">P_ALL</span><span class="f">,</span>
<a name="81" /><span class="True">      81:</span>     <span class="b">P_PID</span><span class="f">,</span>
<a name="82" /><span class="True">      82:</span>     <span class="b">P_PGID</span>
<a name="83" /><span class="True">      83:</span> <span class="f">}</span> <span class="b">idtype_t</span><span class="f">;</span>
<a name="84" /><span class="True">      84:</span> 
<a name="85" /><span class="True">      85:</span> <span class="k">/*</span>
<a name="86" /><span class="True">      86:</span> <span class="k"> * [XSI] The id_t and pid_t types shall be defined as described</span>
<a name="87" /><span class="True">      87:</span> <span class="k"> * in &lt;sys/types.h&gt;</span>
<a name="88" /><span class="True">      88:</span> <span class="k"> */</span>
<a name="89" /><span class="True">      89:</span> <span class="f">#</span><span class="n">include</span> <span class="f">&lt;</span><span class="b">sys</span><span class="f">/</span><span class="b">_types</span><span class="f">/</span><span class="b">_pid_t</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>
<a name="90" /><span class="True">      90:</span> <span class="f">#</span><span class="n">include</span> <span class="f">&lt;</span><span class="b">sys</span><span class="f">/</span><span class="b">_types</span><span class="f">/</span><span class="b">_id_t</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>
<a name="91" /><span class="True">      91:</span> 
<a name="92" /><span class="True">      92:</span> <span class="k">/*</span>
<a name="93" /><span class="True">      93:</span> <span class="k"> * [XSI] The siginfo_t type shall be defined as described in &lt;signal.h&gt;</span>
<a name="94" /><span class="True">      94:</span> <span class="k"> * [XSI] The rusage structure shall be defined as described in &lt;sys/resource.h&gt;</span>
<a name="95" /><span class="True">      95:</span> <span class="k"> * [XSI] Inclusion of the &lt;sys/wait.h&gt; header may also make visible all</span>
<a name="96" /><span class="True">      96:</span> <span class="k"> * symbols from &lt;signal.h&gt; and &lt;sys/resource.h&gt;</span>
<a name="97" /><span class="True">      97:</span> <span class="k"> *</span>
<a name="98" /><span class="True">      98:</span> <span class="k"> * NOTE:    This requirement is currently being satisfied by the direct</span>
<a name="99" /><span class="True">      99:</span> <span class="k"> *        inclusion of &lt;sys/signal.h&gt; and &lt;sys/resource.h&gt;, below.</span>
<a name="100" /><span class="True">     100:</span> <span class="k"> *</span>
<a name="101" /><span class="True">     101:</span> <span class="k"> *        Software should not depend on the exposure of anything other</span>
<a name="102" /><span class="True">     102:</span> <span class="k"> *        than the types siginfo_t and struct rusage as a result of</span>
<a name="103" /><span class="True">     103:</span> <span class="k"> *        this inclusion.  If you depend on any types or manifest</span>
<a name="104" /><span class="True">     104:</span> <span class="k"> *        values othe than siginfo_t and struct rusage from either of</span>
<a name="105" /><span class="True">     105:</span> <span class="k"> *        those files, you should explicitly include them yourself, as</span>
<a name="106" /><span class="True">     106:</span> <span class="k"> *        well, or in future releases your stware may not compile</span>
<a name="107" /><span class="True">     107:</span> <span class="k"> *        without modification.</span>
<a name="108" /><span class="True">     108:</span> <span class="k"> */</span>
<a name="109" /><span class="True">     109:</span> <span class="f">#</span><span class="n">include</span> <span class="f">&lt;</span><span class="b">sys</span><span class="f">/</span><span class="b">signal</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>        <span class="k">/* [XSI] for siginfo_t */</span>
<a name="110" /><span class="True">     110:</span> <span class="f">#</span><span class="n">include</span> <span class="f">&lt;</span><span class="b">sys</span><span class="f">/</span><span class="b">resource</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>    <span class="k">/* [XSI] for struct rusage */</span>
<a name="111" /><span class="True">     111:</span> 
<a name="112" /><span class="True">     112:</span> <span class="k">/*</span>
<a name="113" /><span class="True">     113:</span> <span class="k"> * Option bits for the third argument of wait4.  WNOHANG causes the</span>
<a name="114" /><span class="True">     114:</span> <span class="k"> * wait to not hang if there are no stopped or terminated processes, rather</span>
<a name="115" /><span class="True">     115:</span> <span class="k"> * returning an error indication in this case (pid==0).  WUNTRACED</span>
<a name="116" /><span class="True">     116:</span> <span class="k"> * indicates that the caller should receive status about untraced children</span>
<a name="117" /><span class="True">     117:</span> <span class="k"> * which stop due to signals.  If children are stopped and a wait without</span>
<a name="118" /><span class="True">     118:</span> <span class="k"> * this option is done, it is as though they were still running... nothing</span>
<a name="119" /><span class="True">     119:</span> <span class="k"> * about them is returned.</span>
<a name="120" /><span class="True">     120:</span> <span class="k"> */</span>
<a name="121" /><span class="True">     121:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_V05PSEFOR18w"><span class="b">WNOHANG</span></a>        <span class="c">0x00000001</span>  <span class="k">/* [XSI] no hang in wait/no child to reap */</span>
<a name="122" /><span class="True">     122:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_V1VOVFJBQ0VEXzA_"><span class="b">WUNTRACED</span></a>    <span class="c">0x00000002</span>  <span class="k">/* [XSI] notify on stop, untraced child */</span>
<a name="123" /><span class="True">     123:</span> 
<a name="124" /><span class="True">     124:</span> <span class="k">/*</span>
<a name="125" /><span class="True">     125:</span> <span class="k"> * Macros to test the exit status returned by wait</span>
<a name="126" /><span class="True">     126:</span> <span class="k"> * and extract the relevant values.</span>
<a name="127" /><span class="True">     127:</span> <span class="k"> */</span>
<a name="128" /><span class="False">     128:</span> <span class="f">#</span><span class="n">if</span> <span class="b">defined</span><span class="f">(</span><span class="b">_POSIX_C_SOURCE</span><span class="f">)</span> <span class="f">&amp;&amp;</span> <span class="f">!</span><span class="b">defined</span><span class="f">(</span><a href="macros_ref.html#_X0RBUldJTl9DX1NPVVJDRV8w"><span class="b">_DARWIN_C_SOURCE</span></a><span class="f">)</span>
<a name="129" /><span class="False">     129:</span> <span class="f">#</span><span class="n">define</span>    <a href="macros_noref.html#_X1dfSU5UXzA_"><span class="b">_W_INT</span></a><span class="f">(</span><span class="b">i</span><span class="f">)</span>    <span class="f">(</span><span class="b">i</span><span class="f">)</span>
<a name="130" /><span class="True">     130:</span> <span class="f">#</span><span class="n">else</span>
<a name="131" /><span class="True">     131:</span> <span class="f">#</span><span class="n">define</span>    <a href="macros_noref.html#_X1dfSU5UXzA_"><span class="b">_W_INT</span></a><span class="f">(</span><span class="b">w</span><span class="f">)</span>    <span class="f">(</span><span class="f">*</span><span class="f">(</span><span class="m">int</span> <span class="f">*</span><span class="f">)</span><span class="f">&amp;</span><span class="f">(</span><span class="b">w</span><span class="f">)</span><span class="f">)</span>    <span class="k">/* convert union wait to int */</span>
<a name="132" /><span class="True">     132:</span> <span class="f">#</span><span class="n">define</span>    <a href="macros_noref.html#_V0NPUkVGTEFHXzA_"><span class="b">WCOREFLAG</span></a>    <span class="c">0200</span>
<a name="133" /><span class="True">     133:</span> <span class="f">#</span><span class="n">endif</span> <span class="k">/* (_POSIX_C_SOURCE &amp;&amp; !_DARWIN_C_SOURCE) */</span>
<a name="134" /><span class="True">     134:</span> 
<a name="135" /><span class="True">     135:</span> <span class="k">/* These macros are permited, as they are in the implementation namespace */</span>
<a name="136" /><span class="True">     136:</span> <span class="f">#</span><span class="n">define</span>    <a href="macros_noref.html#_X1dTVEFUVVNfMA__"><span class="b">_WSTATUS</span></a><span class="f">(</span><span class="b">x</span><span class="f">)</span>    <span class="f">(</span><a href="macros_noref.html#_X1dfSU5UXzA_"><span class="b">_W_INT</span></a><span class="f">(</span><span class="b">x</span><span class="f">)</span> <span class="f">&amp;</span> <span class="c">0177</span><span class="f">)</span>
<a name="137" /><span class="True">     137:</span> <span class="f">#</span><span class="n">define</span>    <a href="macros_noref.html#_X1dTVE9QUEVEXzA_"><span class="b">_WSTOPPED</span></a>    <span class="c">0177</span>        <span class="k">/* _WSTATUS if process is stopped */</span>
<a name="138" /><span class="True">     138:</span> 
<a name="139" /><span class="True">     139:</span> <span class="k">/*</span>
<a name="140" /><span class="True">     140:</span> <span class="k"> * [XSI] The &lt;sys/wait.h&gt; header shall define the following macros for</span>
<a name="141" /><span class="True">     141:</span> <span class="k"> * analysis of process status values</span>
<a name="142" /><span class="True">     142:</span> <span class="k"> */</span>
<a name="143" /><span class="True">     143:</span> <span class="f">#</span><span class="n">if</span> <a href="macros_ref.html#_X19EQVJXSU5fVU5JWDAzXzA_"><span class="b">__DARWIN_UNIX03</span></a>
<a name="144" /><span class="True">     144:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_V0VYSVRTVEFUVVNfMA__"><span class="b">WEXITSTATUS</span></a><span class="f">(</span><span class="b">x</span><span class="f">)</span>    <span class="f">(</span><span class="f">(</span><a href="macros_noref.html#_X1dfSU5UXzA_"><span class="b">_W_INT</span></a><span class="f">(</span><span class="b">x</span><span class="f">)</span> <span class="f">&gt;&gt;</span> <span class="c">8</span><span class="f">)</span> <span class="f">&amp;</span> <span class="c">0x000000ff</span><span class="f">)</span>
<a name="145" /><span class="False">     145:</span> <span class="f">#</span><span class="n">else</span> <span class="k">/* !__DARWIN_UNIX03 */</span>
<a name="146" /><span class="False">     146:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_V0VYSVRTVEFUVVNfMA__"><span class="b">WEXITSTATUS</span></a><span class="f">(</span><span class="b">x</span><span class="f">)</span>    <span class="f">(</span><a href="macros_noref.html#_X1dfSU5UXzA_"><span class="b">_W_INT</span></a><span class="f">(</span><span class="b">x</span><span class="f">)</span> <span class="f">&gt;&gt;</span> <span class="c">8</span><span class="f">)</span>
<a name="147" /><span class="True">     147:</span> <span class="f">#</span><span class="n">endif</span> <span class="k">/* !__DARWIN_UNIX03 */</span>
<a name="148" /><span class="True">     148:</span> <span class="k">/* 0x13 == SIGCONT */</span>
<a name="149" /><span class="True">     149:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_V1NUT1BTSUdfMA__"><span class="b">WSTOPSIG</span></a><span class="f">(</span><span class="b">x</span><span class="f">)</span>    <span class="f">(</span><a href="macros_noref.html#_X1dfSU5UXzA_"><span class="b">_W_INT</span></a><span class="f">(</span><span class="b">x</span><span class="f">)</span> <span class="f">&gt;&gt;</span> <span class="c">8</span><span class="f">)</span>
<a name="150" /><span class="True">     150:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_V0lGQ09OVElOVUVEXzA_"><span class="b">WIFCONTINUED</span></a><span class="f">(</span><span class="b">x</span><span class="f">)</span> <span class="f">(</span><a href="macros_noref.html#_X1dTVEFUVVNfMA__"><span class="b">_WSTATUS</span></a><span class="f">(</span><span class="b">x</span><span class="f">)</span> <span class="f">==</span> <a href="macros_noref.html#_X1dTVE9QUEVEXzA_"><span class="b">_WSTOPPED</span></a> <span class="f">&amp;&amp;</span> <a href="macros_noref.html#_V1NUT1BTSUdfMA__"><span class="b">WSTOPSIG</span></a><span class="f">(</span><span class="b">x</span><span class="f">)</span> <span class="f">==</span> <span class="c">0x13</span><span class="f">)</span>
<a name="151" /><span class="True">     151:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_V0lGU1RPUFBFRF8w"><span class="b">WIFSTOPPED</span></a><span class="f">(</span><span class="b">x</span><span class="f">)</span>    <span class="f">(</span><a href="macros_noref.html#_X1dTVEFUVVNfMA__"><span class="b">_WSTATUS</span></a><span class="f">(</span><span class="b">x</span><span class="f">)</span> <span class="f">==</span> <a href="macros_noref.html#_X1dTVE9QUEVEXzA_"><span class="b">_WSTOPPED</span></a> <span class="f">&amp;&amp;</span> <a href="macros_noref.html#_V1NUT1BTSUdfMA__"><span class="b">WSTOPSIG</span></a><span class="f">(</span><span class="b">x</span><span class="f">)</span> <span class="f">!=</span> <span class="c">0x13</span><span class="f">)</span>
<a name="152" /><span class="True">     152:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_V0lGRVhJVEVEXzA_"><span class="b">WIFEXITED</span></a><span class="f">(</span><span class="b">x</span><span class="f">)</span>    <span class="f">(</span><a href="macros_noref.html#_X1dTVEFUVVNfMA__"><span class="b">_WSTATUS</span></a><span class="f">(</span><span class="b">x</span><span class="f">)</span> <span class="f">==</span> <span class="c">0</span><span class="f">)</span>
<a name="153" /><span class="True">     153:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_V0lGU0lHTkFMRURfMA__"><span class="b">WIFSIGNALED</span></a><span class="f">(</span><span class="b">x</span><span class="f">)</span>    <span class="f">(</span><a href="macros_noref.html#_X1dTVEFUVVNfMA__"><span class="b">_WSTATUS</span></a><span class="f">(</span><span class="b">x</span><span class="f">)</span> <span class="f">!=</span> <a href="macros_noref.html#_X1dTVE9QUEVEXzA_"><span class="b">_WSTOPPED</span></a> <span class="f">&amp;&amp;</span> <a href="macros_noref.html#_X1dTVEFUVVNfMA__"><span class="b">_WSTATUS</span></a><span class="f">(</span><span class="b">x</span><span class="f">)</span> <span class="f">!=</span> <span class="c">0</span><span class="f">)</span>
<a name="154" /><span class="True">     154:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_V1RFUk1TSUdfMA__"><span class="b">WTERMSIG</span></a><span class="f">(</span><span class="b">x</span><span class="f">)</span>    <span class="f">(</span><a href="macros_noref.html#_X1dTVEFUVVNfMA__"><span class="b">_WSTATUS</span></a><span class="f">(</span><span class="b">x</span><span class="f">)</span><span class="f">)</span>
<a name="155" /><span class="True">     155:</span> <span class="f">#</span><span class="n">if</span> <span class="f">(</span><span class="f">!</span><span class="b">defined</span><span class="f">(</span><span class="b">_POSIX_C_SOURCE</span><span class="f">)</span> <span class="f">||</span> <span class="b">defined</span><span class="f">(</span><a href="macros_ref.html#_X0RBUldJTl9DX1NPVVJDRV8w"><span class="b">_DARWIN_C_SOURCE</span></a><span class="f">)</span><span class="f">)</span>
<a name="156" /><span class="True">     156:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_V0NPUkVEVU1QXzA_"><span class="b">WCOREDUMP</span></a><span class="f">(</span><span class="b">x</span><span class="f">)</span>    <span class="f">(</span><a href="macros_noref.html#_X1dfSU5UXzA_"><span class="b">_W_INT</span></a><span class="f">(</span><span class="b">x</span><span class="f">)</span> <span class="f">&amp;</span> <a href="macros_noref.html#_V0NPUkVGTEFHXzA_"><span class="b">WCOREFLAG</span></a><span class="f">)</span>
<a name="157" /><span class="True">     157:</span> 
<a name="158" /><span class="True">     158:</span> <span class="f">#</span><span class="n">define</span>    <a href="macros_noref.html#_V19FWElUQ09ERV8w"><span class="b">W_EXITCODE</span></a><span class="f">(</span><span class="b">ret</span><span class="f">,</span> <span class="b">sig</span><span class="f">)</span>    <span class="f">(</span><span class="f">(</span><span class="b">ret</span><span class="f">)</span> <span class="f">&lt;&lt;</span> <span class="c">8</span> <span class="f">|</span> <span class="f">(</span><span class="b">sig</span><span class="f">)</span><span class="f">)</span>
<a name="159" /><span class="True">     159:</span> <span class="f">#</span><span class="n">define</span>    <a href="macros_noref.html#_V19TVE9QQ09ERV8w"><span class="b">W_STOPCODE</span></a><span class="f">(</span><span class="b">sig</span><span class="f">)</span>        <span class="f">(</span><span class="f">(</span><span class="b">sig</span><span class="f">)</span> <span class="f">&lt;&lt;</span> <span class="c">8</span> <span class="f">|</span> <a href="macros_noref.html#_X1dTVE9QUEVEXzA_"><span class="b">_WSTOPPED</span></a><span class="f">)</span>
<a name="160" /><span class="True">     160:</span> <span class="f">#</span><span class="n">endif</span> <span class="k">/* (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) */</span>
<a name="161" /><span class="True">     161:</span> 
<a name="162" /><span class="True">     162:</span> <span class="k">/*</span>
<a name="163" /><span class="True">     163:</span> <span class="k"> * [XSI] The following symbolic constants shall be defined as possible</span>
<a name="164" /><span class="True">     164:</span> <span class="k"> * values for the fourth argument to waitid().</span>
<a name="165" /><span class="True">     165:</span> <span class="k"> */</span>
<a name="166" /><span class="True">     166:</span> <span class="k">/* WNOHANG already defined for wait4() */</span>
<a name="167" /><span class="True">     167:</span> <span class="k">/* WUNTRACED defined for wait4() but not for waitid() */</span>
<a name="168" /><span class="True">     168:</span> <span class="f">#</span><span class="n">define</span>    <a href="macros_noref.html#_V0VYSVRFRF8w"><span class="b">WEXITED</span></a>        <span class="c">0x00000004</span>  <span class="k">/* [XSI] Processes which have exitted */</span>
<a name="169" /><span class="True">     169:</span> <span class="f">#</span><span class="n">if</span> <a href="macros_ref.html#_X19EQVJXSU5fVU5JWDAzXzA_"><span class="b">__DARWIN_UNIX03</span></a>
<a name="170" /><span class="True">     170:</span> <span class="k">/* waitid() parameter */</span>
<a name="171" /><span class="True">     171:</span> <span class="f">#</span><span class="n">define</span>    <a href="macros_noref.html#_V1NUT1BQRURfMA__"><span class="b">WSTOPPED</span></a>    <span class="c">0x00000008</span>  <span class="k">/* [XSI] Any child stopped by signal */</span>
<a name="172" /><span class="True">     172:</span> <span class="f">#</span><span class="n">endif</span>
<a name="173" /><span class="True">     173:</span> <span class="f">#</span><span class="n">define</span>    <a href="macros_noref.html#_V0NPTlRJTlVFRF8w"><span class="b">WCONTINUED</span></a>    <span class="c">0x00000010</span>  <span class="k">/* [XSI] Any child stopped then continued */</span>
<a name="174" /><span class="True">     174:</span> <span class="f">#</span><span class="n">define</span>    <a href="macros_noref.html#_V05PV0FJVF8w"><span class="b">WNOWAIT</span></a>        <span class="c">0x00000020</span>  <span class="k">/* [XSI] Leave process returned waitable */</span>
<a name="175" /><span class="True">     175:</span> 
<a name="176" /><span class="True">     176:</span> 
<a name="177" /><span class="True">     177:</span> <span class="f">#</span><span class="n">if</span> <span class="f">(</span><span class="f">!</span><span class="b">defined</span><span class="f">(</span><span class="b">_POSIX_C_SOURCE</span><span class="f">)</span> <span class="f">||</span> <span class="b">defined</span><span class="f">(</span><a href="macros_ref.html#_X0RBUldJTl9DX1NPVVJDRV8w"><span class="b">_DARWIN_C_SOURCE</span></a><span class="f">)</span><span class="f">)</span>
<a name="178" /><span class="True">     178:</span> <span class="k">/* POSIX extensions and 4.2/4.3 compatability: */</span>
<a name="179" /><span class="True">     179:</span> 
<a name="180" /><span class="True">     180:</span> <span class="k">/*</span>
<a name="181" /><span class="True">     181:</span> <span class="k"> * Tokens for special values of the &quot;pid&quot; parameter to wait4.</span>
<a name="182" /><span class="True">     182:</span> <span class="k"> */</span>
<a name="183" /><span class="True">     183:</span> <span class="f">#</span><span class="n">define</span>    <a href="macros_noref.html#_V0FJVF9BTllfMA__"><span class="b">WAIT_ANY</span></a>    <span class="f">(</span><span class="f">-</span><span class="c">1</span><span class="f">)</span>    <span class="k">/* any process */</span>
<a name="184" /><span class="True">     184:</span> <span class="f">#</span><span class="n">define</span>    <a href="macros_noref.html#_V0FJVF9NWVBHUlBfMA__"><span class="b">WAIT_MYPGRP</span></a>    <span class="c">0</span>    <span class="k">/* any process in my process group */</span>
<a name="185" /><span class="True">     185:</span> 
<a name="186" /><span class="True">     186:</span> <span class="f">#</span><span class="n">include</span> <span class="f">&lt;</span><span class="b">machine</span><span class="f">/</span><span class="b">endian</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>
<a name="187" /><span class="True">     187:</span> 
<a name="188" /><span class="True">     188:</span> <span class="k">/*</span>
<a name="189" /><span class="True">     189:</span> <span class="k"> * Deprecated:</span>
<a name="190" /><span class="True">     190:</span> <span class="k"> * Structure of the information in the status word returned by wait4.</span>
<a name="191" /><span class="True">     191:</span> <span class="k"> * If w_stopval==_WSTOPPED, then the second structure describes</span>
<a name="192" /><span class="True">     192:</span> <span class="k"> * the information returned, else the first.</span>
<a name="193" /><span class="True">     193:</span> <span class="k"> */</span>
<a name="194" /><span class="True">     194:</span> <span class="m">union</span> <span class="b">wait</span> <span class="f">{</span>
<a name="195" /><span class="True">     195:</span>     <span class="m">int</span>    <span class="b">w_status</span><span class="f">;</span>        <span class="k">/* used in syscall */</span>
<a name="196" /><span class="True">     196:</span>     <span class="k">/*</span>
<a name="197" /><span class="True">     197:</span> <span class="k">     * Terminated process status.</span>
<a name="198" /><span class="True">     198:</span> <span class="k">     */</span>
<a name="199" /><span class="True">     199:</span>     <span class="m">struct</span> <span class="f">{</span>
<a name="200" /><span class="True">     200:</span> <span class="f">#</span><span class="n">if</span> <a href="macros_ref.html#_X19EQVJXSU5fQllURV9PUkRFUl8w"><span class="b">__DARWIN_BYTE_ORDER</span></a> <span class="f">==</span> <a href="macros_ref.html#_X19EQVJXSU5fTElUVExFX0VORElBTl8w"><span class="b">__DARWIN_LITTLE_ENDIAN</span></a> 
<a name="201" /><span class="True">     201:</span>         <span class="m">unsigned</span> <span class="m">int</span>    <span class="b">w_Termsig</span><span class="f">:</span><span class="c">7</span><span class="f">,</span>    <span class="k">/* termination signal */</span>
<a name="202" /><span class="True">     202:</span>                 <span class="b">w_Coredump</span><span class="f">:</span><span class="c">1</span><span class="f">,</span>    <span class="k">/* core dump indicator */</span>
<a name="203" /><span class="True">     203:</span>                 <span class="b">w_Retcode</span><span class="f">:</span><span class="c">8</span><span class="f">,</span>    <span class="k">/* exit code if w_termsig==0 */</span>
<a name="204" /><span class="True">     204:</span>                 <span class="b">w_Filler</span><span class="f">:</span><span class="c">16</span><span class="f">;</span>    <span class="k">/* upper bits filler */</span>
<a name="205" /><span class="True">     205:</span> <span class="f">#</span><span class="n">endif</span>
<a name="206" /><span class="False">     206:</span> <span class="f">#</span><span class="n">if</span> <a href="macros_ref.html#_X19EQVJXSU5fQllURV9PUkRFUl8w"><span class="b">__DARWIN_BYTE_ORDER</span></a> <span class="f">==</span> <a href="macros_ref.html#_X19EQVJXSU5fQklHX0VORElBTl8w"><span class="b">__DARWIN_BIG_ENDIAN</span></a> 
<a name="207" /><span class="False">     207:</span>         <span class="m">unsigned</span> <span class="m">int</span>    <span class="b">w_Filler</span><span class="f">:</span><span class="c">16</span><span class="f">,</span>    <span class="k">/* upper bits filler */</span>
<a name="208" /><span class="False">     208:</span>                 <span class="b">w_Retcode</span><span class="f">:</span><span class="c">8</span><span class="f">,</span>    <span class="k">/* exit code if w_termsig==0 */</span>
<a name="209" /><span class="False">     209:</span>                 <span class="b">w_Coredump</span><span class="f">:</span><span class="c">1</span><span class="f">,</span>    <span class="k">/* core dump indicator */</span>
<a name="210" /><span class="False">     210:</span>                 <span class="b">w_Termsig</span><span class="f">:</span><span class="c">7</span><span class="f">;</span>    <span class="k">/* termination signal */</span>
<a name="211" /><span class="True">     211:</span> <span class="f">#</span><span class="n">endif</span>
<a name="212" /><span class="True">     212:</span>     <span class="f">}</span> <span class="b">w_T</span><span class="f">;</span>
<a name="213" /><span class="True">     213:</span>     <span class="k">/*</span>
<a name="214" /><span class="True">     214:</span> <span class="k">     * Stopped process status.  Returned</span>
<a name="215" /><span class="True">     215:</span> <span class="k">     * only for traced children unless requested</span>
<a name="216" /><span class="True">     216:</span> <span class="k">     * with the WUNTRACED option bit.</span>
<a name="217" /><span class="True">     217:</span> <span class="k">     */</span>
<a name="218" /><span class="True">     218:</span>     <span class="m">struct</span> <span class="f">{</span>
<a name="219" /><span class="True">     219:</span> <span class="f">#</span><span class="n">if</span> <a href="macros_ref.html#_X19EQVJXSU5fQllURV9PUkRFUl8w"><span class="b">__DARWIN_BYTE_ORDER</span></a> <span class="f">==</span> <a href="macros_ref.html#_X19EQVJXSU5fTElUVExFX0VORElBTl8w"><span class="b">__DARWIN_LITTLE_ENDIAN</span></a> 
<a name="220" /><span class="True">     220:</span>         <span class="m">unsigned</span> <span class="m">int</span>    <span class="b">w_Stopval</span><span class="f">:</span><span class="c">8</span><span class="f">,</span>    <span class="k">/* == W_STOPPED if stopped */</span>
<a name="221" /><span class="True">     221:</span>                 <span class="b">w_Stopsig</span><span class="f">:</span><span class="c">8</span><span class="f">,</span>    <span class="k">/* signal that stopped us */</span>
<a name="222" /><span class="True">     222:</span>                 <span class="b">w_Filler</span><span class="f">:</span><span class="c">16</span><span class="f">;</span>    <span class="k">/* upper bits filler */</span>
<a name="223" /><span class="True">     223:</span> <span class="f">#</span><span class="n">endif</span>
<a name="224" /><span class="False">     224:</span> <span class="f">#</span><span class="n">if</span> <a href="macros_ref.html#_X19EQVJXSU5fQllURV9PUkRFUl8w"><span class="b">__DARWIN_BYTE_ORDER</span></a> <span class="f">==</span> <a href="macros_ref.html#_X19EQVJXSU5fQklHX0VORElBTl8w"><span class="b">__DARWIN_BIG_ENDIAN</span></a> 
<a name="225" /><span class="False">     225:</span>         <span class="m">unsigned</span> <span class="m">int</span>    <span class="b">w_Filler</span><span class="f">:</span><span class="c">16</span><span class="f">,</span>    <span class="k">/* upper bits filler */</span>
<a name="226" /><span class="False">     226:</span>                 <span class="b">w_Stopsig</span><span class="f">:</span><span class="c">8</span><span class="f">,</span>    <span class="k">/* signal that stopped us */</span>
<a name="227" /><span class="False">     227:</span>                 <span class="b">w_Stopval</span><span class="f">:</span><span class="c">8</span><span class="f">;</span>    <span class="k">/* == W_STOPPED if stopped */</span>
<a name="228" /><span class="True">     228:</span> <span class="f">#</span><span class="n">endif</span>
<a name="229" /><span class="True">     229:</span>     <span class="f">}</span> <span class="b">w_S</span><span class="f">;</span>
<a name="230" /><span class="True">     230:</span> <span class="f">}</span><span class="f">;</span>
<a name="231" /><span class="True">     231:</span> <span class="f">#</span><span class="n">define</span>    <a href="macros_noref.html#_d190ZXJtc2lnXzA_"><span class="b">w_termsig</span></a>    <span class="b">w_T</span><span class="f">.</span><span class="b">w_Termsig</span>
<a name="232" /><span class="True">     232:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_d19jb3JlZHVtcF8w"><span class="b">w_coredump</span></a>    <span class="b">w_T</span><span class="f">.</span><span class="b">w_Coredump</span>
<a name="233" /><span class="True">     233:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_d19yZXRjb2RlXzA_"><span class="b">w_retcode</span></a>    <span class="b">w_T</span><span class="f">.</span><span class="b">w_Retcode</span>
<a name="234" /><span class="True">     234:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_d19zdG9wdmFsXzA_"><span class="b">w_stopval</span></a>    <span class="b">w_S</span><span class="f">.</span><span class="b">w_Stopval</span>
<a name="235" /><span class="True">     235:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_d19zdG9wc2lnXzA_"><span class="b">w_stopsig</span></a>    <span class="b">w_S</span><span class="f">.</span><span class="b">w_Stopsig</span>
<a name="236" /><span class="True">     236:</span> 
<a name="237" /><span class="True">     237:</span> <span class="f">#</span><span class="n">endif</span> <span class="k">/* (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) */</span>
<a name="238" /><span class="True">     238:</span> 
<a name="239" /><span class="True">     239:</span> <span class="f">#</span><span class="n">if</span> <span class="f">!</span><span class="f">(</span><a href="macros_ref.html#_X19EQVJXSU5fVU5JWDAzXzA_"><span class="b">__DARWIN_UNIX03</span></a> <span class="f">-</span> <span class="c">0</span><span class="f">)</span>
<a name="240" /><span class="True">     240:</span> <span class="k">/*</span>
<a name="241" /><span class="True">     241:</span> <span class="k"> * Stopped state value; cannot use waitid() parameter of the same name</span>
<a name="242" /><span class="True">     242:</span> <span class="k"> * in the same scope</span>
<a name="243" /><span class="True">     243:</span> <span class="k"> */</span>
<a name="244" /><span class="True">     244:</span> <span class="f">#</span><span class="n">define</span>    <a href="macros_noref.html#_V1NUT1BQRURfMA__"><span class="b">WSTOPPED</span></a>    <a href="macros_noref.html#_X1dTVE9QUEVEXzA_"><span class="b">_WSTOPPED</span></a>
<a name="245" /><span class="True">     245:</span> <span class="f">#</span><span class="n">endif</span> <span class="k">/* !__DARWIN_UNIX03 */</span>
<a name="246" /><span class="True">     246:</span> 
<a name="247" /><span class="True">     247:</span> <a href="macros_ref.html#_X19CRUdJTl9ERUNMU18w"><span class="b">__BEGIN_DECLS</span></a>
<a name="248" /><span class="True">     248:</span> <span class="b">pid_t</span>    <span class="b">wait</span><span class="f">(</span><span class="m">int</span> <span class="f">*</span><span class="f">)</span> <a href="macros_ref.html#_X19EQVJXSU5fQUxJQVNfQ18w"><span class="b">__DARWIN_ALIAS_C</span></a><span class="f">(</span><span class="b">wait</span><span class="f">)</span><span class="f">;</span>
<a name="249" /><span class="True">     249:</span> <span class="b">pid_t</span>    <span class="b">waitpid</span><span class="f">(</span><span class="b">pid_t</span><span class="f">,</span> <span class="m">int</span> <span class="f">*</span><span class="f">,</span> <span class="m">int</span><span class="f">)</span> <a href="macros_ref.html#_X19EQVJXSU5fQUxJQVNfQ18w"><span class="b">__DARWIN_ALIAS_C</span></a><span class="f">(</span><span class="b">waitpid</span><span class="f">)</span><span class="f">;</span>
<a name="250" /><span class="True">     250:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">_ANSI_SOURCE</span>
<a name="251" /><span class="True">     251:</span> <span class="m">int</span>    <span class="b">waitid</span><span class="f">(</span><span class="b">idtype_t</span><span class="f">,</span> <span class="b">id_t</span><span class="f">,</span> <span class="b">siginfo_t</span> <span class="f">*</span><span class="f">,</span> <span class="m">int</span><span class="f">)</span> <a href="macros_ref.html#_X19EQVJXSU5fQUxJQVNfQ18w"><span class="b">__DARWIN_ALIAS_C</span></a><span class="f">(</span><span class="b">waitid</span><span class="f">)</span><span class="f">;</span>
<a name="252" /><span class="True">     252:</span> <span class="f">#</span><span class="n">endif</span> <span class="k">/* !_ANSI_SOURCE */</span>
<a name="253" /><span class="True">     253:</span> <span class="f">#</span><span class="n">if</span>  <span class="f">(</span><span class="f">!</span><span class="b">defined</span><span class="f">(</span><span class="b">_POSIX_C_SOURCE</span><span class="f">)</span> <span class="f">||</span> <span class="b">defined</span><span class="f">(</span><a href="macros_ref.html#_X0RBUldJTl9DX1NPVVJDRV8w"><span class="b">_DARWIN_C_SOURCE</span></a><span class="f">)</span><span class="f">)</span>
<a name="254" /><span class="True">     254:</span> <span class="b">pid_t</span>    <span class="b">wait3</span><span class="f">(</span><span class="m">int</span> <span class="f">*</span><span class="f">,</span> <span class="m">int</span><span class="f">,</span> <span class="m">struct</span> <span class="b">rusage</span> <span class="f">*</span><span class="f">)</span><span class="f">;</span>
<a name="255" /><span class="True">     255:</span> <span class="b">pid_t</span>    <span class="b">wait4</span><span class="f">(</span><span class="b">pid_t</span><span class="f">,</span> <span class="m">int</span> <span class="f">*</span><span class="f">,</span> <span class="m">int</span><span class="f">,</span> <span class="m">struct</span> <span class="b">rusage</span> <span class="f">*</span><span class="f">)</span><span class="f">;</span>
<a name="256" /><span class="True">     256:</span> <span class="f">#</span><span class="n">endif</span> <span class="k">/* (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) */</span>
<a name="257" /><span class="True">     257:</span> <a href="macros_ref.html#_X19FTkRfREVDTFNfMA__"><span class="b">__END_DECLS</span></a>
<a name="258" /><span class="True">     258:</span> <span class="f">#</span><span class="n">endif</span> <span class="k">/* !_SYS_WAIT_H_ */</span>
<a name="259" /><span class="True">     259:</span> </pre>
  </body>
</html>
